<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>登录</title>
</head>
<script type="text/javascript" language="javascript" th:src="@{/_resources/lib/jquery/jquery.min.js}"></script>
<script type="text/javascript" language="javascript" th:src="@{/_resources/lib/bootstrap-3.3.7-dist/css/bootstrap.min.css}"></script>
<script type="text/javascript" language="javascript" th:src="@{/_resources/lib/bootstrap-3.3.7-dist/js/bootstrap.min.js}"></script>
<script type="text/javascript" language="javascript" th:src="@{/_resources/yiper/js/jquery.form.js}"></script>

<body>

    <form action="/login" id="loginForm">
        <table>
            <tr>
                <td>用户名:</td>
                <td><input name="username"/></td>
            </tr>
            <tr>
                <td>密码</td>
                <td><input name="password" type="password"/></td>
            </tr>
        </table>
        <input name="verification"/>
        <img src="/verificationCode" class="pointer vcode-img">
        <div id="login">登录</div>
        <div class="change-type">
            <label>
                <input type="checkbox" id="rememberMe" name="rememberMe" value="1"> <i style="color: #fff;">记住我</i>
            </label>
        </div>
    </form>
</body>
<script type="text/javascript" language="javascript">
    $(function(){
        $(".vcode-img").on('click', function () {
//            var url = '/Creditgt.jpg?d='+Math.random();
//            $(this).attr('src',url);
            $(this).attr('src', '/verificationCode?' + Math.floor(Math.random() * 100));
        });

        $("#login").click(function(){
            var options = {
                type: "POST",
                /*url:"/orderFeesve",*/
                success: function (data) {
                    console.log(data.code);
                    if (data.code == 200) {
                        window.location.href = "/index";
                    }

                }
            }
            $("#loginForm").ajaxSubmit(options);

        });
        console.log("hahha");
    });
</script>
</html>
